<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="./js/vue.js"></script>
    <style>
        .list-enter,
        .list-leave-to {
            opacity: 0;
            transform: translateY(70px);
        }

        .list-enter-to,
        .list-leave {
            opacity: 1;
        }

        .list-enter-active,
        .list-leave-active {
            transition: all 1s;
        }
    </style>
</head>

<body>
    <div id="app">
        <form action="#" @submit.prevent="add">
            <input type="text" v-model="value" name="" id="">
            <button type="submit">添加</button>
        </form>

        <transition-group tag="ul" name="list" mode="in-out">
            <li v-for="(item,index) in list" :key="index" @dblclick="del(index)">{{item}}</li>
        </transition-group>
    </div>
    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                list: [1, 2, 3, 4, 5, 6, 7, 8, 9],
                value: ""
            },
            methods: {
                add() {
                    this.list.push(this.value)
                },
                del(index){
                    this.list.splice(index,1);
                }
            }
        })
    </script>
</body>

<html>